package com.object.oriented.exam.system8.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.object.oriented.exam.system1.dao.ProblemMapping;
import com.object.oriented.exam.system1.entity.Problem;
import com.object.oriented.exam.system2.dao.ProblemPropertyMapping;
import com.object.oriented.exam.system2.entity.ProblemProperty;
import com.object.oriented.exam.system5.entity.Answer;
import com.object.oriented.exam.system5.service.AnswerService;
import com.object.oriented.exam.system8.entity.Question;
import com.object.oriented.exam.system8.service.PracticeService;
import com.object.oriented.exam.system8.service.QuestionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author xdf
 * @date 2023-06-20
 */
@Service
public class PracticeServiceImpl implements PracticeService {

    @Resource
    ProblemMapping problemMapping;

    @Resource
    QuestionService questionService;

    @Override
    public Question commit(Answer answer) {
        return questionService.getQuestion(answer);
    }

    @Override
    public List<Problem> practice(Long knowledgeId){
        QueryWrapper<Problem> problemQueryWrapper=new QueryWrapper<>();
        problemQueryWrapper
                .eq("knowledge_id",knowledgeId);
        return problemMapping.selectList(problemQueryWrapper);
    }
}
